package com.itachi.common.core.utils;

public class StringUtils extends org.apache.commons.lang3.StringUtils {

    /** 空字符串 */
    private static final String NULLSTR = "";

    /** 下划线 */
    private static final char SEPARATOR = '_';

    /** 星号 */
    private static final char ASTERISK = '*';

    public static String hide(CharSequence str, int startInclude, int endExclude)
    {
        if (isEmpty(str)) return NULLSTR;
        final int strLength = str.length();
        if (startInclude > strLength) return NULLSTR;
        if (endExclude > strLength) endExclude = strLength;
        if (startInclude > endExclude) return NULLSTR;
        final char[] chars = new char[strLength];
        for (int i = 0; i < strLength; i++)
        {
            if (i >= startInclude && i < endExclude) chars[i] = ASTERISK;
            else chars[i] = str.charAt(i);
        }
        return new String(chars);
    }


}
